#
# Makefile e-motioncontrol
#

PROJECT=e-motioncontrol
CC=gcc
CFLAGS=`pkg-config --cflags gtk+-2.0` -I`ocamlc -where` -L`ocamlc -where` -Wall -W -Wlong-long -pedantic -lX11 -lXtst
INCLUDE= -I/include -I/usr/X11R6/include -L/usr/X11R6/lib
FILES= e-motioncontrol.c errors.c network.c wiimote.c hid.c trajectory.c chrsys.c
FOBJS= $(FILES:.c=.o)
LDFLAGS=`pkg-config --libs gtk+-2.0` -lbluetooth -lm
LIBCAML=-ccopt -L/usr/local/lib -cclib -lgtk-x11-2.0 -cclib -lbluetooth

all: ${PROJECT}

${PROJECT}: ${FOBJS} ${PROJECT}.o
	gtk-builder-convert interface.glade interface.xml
	ocamlc -output-obj -o caml.o Automaton.ml Chrs.ml Main.ml
	gcc ${CFLAGS} ${LDFLAGS} caml.o ${FOBJS} -lcamlrun -lncurses -export-dynamic -o ${PROJECT}

%.o: %.c
	${CC} ${CFLAGS} $(LDFLAGS) ${INCLUDE} -o $@ -c $<

clean::
	rm -f *.o
	rm -f *.cmi
	rm -f *.cmx

#
# END
#
